//
//  CLocator.h
//  HCHK_iphone
//
//  Created by yilong zhang on 12-1-5.
//  Copyright 2012年 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <MapKit/MKMapView.h>
#import <MapKit/MKReverseGeocoder.h>
#import <MapKit/MKPlacemark.h>
#import <string.h>
#import <netinet/in.h>
#import <sys/socket.h>
#import <SystemConfiguration/SCNetworkReachability.h>
#import "Message.h"
#import "CDownLoadManager.h"

//=================================================================================================================

typedef enum {NormalSupport, DevNotSupport, NetNotSupport, AuthNotSupport, Other}LocalRet;

//=================================================================================================================

@interface CAddrInfo : NSObject

@property (nonatomic, retain) NSString *m_strCountry;                               //国家
@property (nonatomic, retain) NSString *m_strProvince;                              //省份，二级
@property (nonatomic, retain) NSString *m_strCity;                                  //城市，三级
@property (nonatomic, retain) NSString *m_strSum;                                   //概要
@property (nonatomic, assign) CGFloat  m_fX;                                        //纬度
@property (nonatomic, assign) CGFloat  m_fY;                                        //经度

@end

//=================================================================================================================

@interface CLocator : NSObject <CLLocationManagerDelegate>

@property (nonatomic, assign) CLLocationManager         *m_LocationManager;         //定位器
@property (nonatomic, assign) BOOL                      m_bIsLocationOpen;          //标志定位是否正常
@property (nonatomic, assign) CLLocationCoordinate2D    m_Coordinate2D;             //记录上次定位的经纬度值
@property (nonatomic, assign) NSMutableData             *m_Data;                    //保存从谷歌返回的地理信息
@property (nonatomic, assign) CAddrInfo                 *m_AddrInfo;                //地理信息
@property (nonatomic, assign) NSTimer                   *m_Timer;                   //检测定位超时
@property (nonatomic, assign) BOOL                      m_bIsCheckNetState;         //是否检测网络
@property (nonatomic, assign) int                       m_nNetState;                //网络状态，1通，0不联通
@property (nonatomic, assign) float                     m_fUpdateDistance;          //定位刷新距离
@property (nonatomic, assign) BOOL                      m_bIsForcedLocal;           //是否强制定位

+(CLocator*)DefaultLocator;
+(void)DestroyLocator;

//检测设备是否能够正常定位
-(int)CheckDevLocation;
//检查网络
-(int)CheckNetState;
//开始定位
-(int)StartLocation;
//停止定位
-(void)StopLocation;
//定位超时
-(void)WaitLoactionRetTimeout:(NSTimer*)timer;
//使用经纬度向谷歌请求地理信息
-(void)GetAddressInfoWithParams:(Language)language Coordinate:(CLLocationCoordinate2D)coordinate;

@end
